﻿
using MBOP.Core.DTO;

namespace MBOP.Website.Controllers
{
	#region Usings 

	using System;
	using System.Collections.Generic;
	using System.Linq;
	using System.Web;
	using System.Web.Mvc;

	using MBOP.Core.Interfaces.Services;

	#endregion

	public class PersonPickerController : Controller
	{
		#region Constants

		/// <summary>
		/// Represents person list partial view name.
		/// </summary>
		private const string PARTIAL_VIEW_PERSON_LIST = @"~/Views/Tooltips/PersonList.cshtml";

		#endregion

		#region Private Fields

		private IPersonInformationService _personInfoService;

		#endregion

		public PersonPickerController(IPersonInformationService personInfoService)
		{
			_personInfoService = personInfoService;
		}

		/// <summary>
		/// Processes get person list request
		/// </summary>
		/// <param name="nameSequence">The finding name sequence</param>
		/// <param name="isRestricted">The location restricted indicator.</param>
		/// <returns>The person list.</returns>
		public PartialViewResult GetPersonList(string nameSequence,bool isRestricted)
		{
			IEnumerable<PersonInfo> personList = this._personInfoService.GetPersonList(nameSequence,isRestricted);

			return this.PartialView(PARTIAL_VIEW_PERSON_LIST, personList);
		}

	}
}
